package com.example.activity_service.dao;

import com.example.activity_service.vo.Draw;
import com.example.activity_service.vo.Red;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface Prizesdao {
    @Select ("select * from hongbao order by id desc limit 6")
    @Results({
            @Result(property = "users",column = "users"),
            @Result(property = "redenvelopes",column = "redenvelopes")
    })
    List<Draw> draws();

    @Insert("insert into hongbao (redenvelopes,instructions,preferentialway,parvalue,threshold,totalissued,collectiontime,timedata,scopeofapplication,receivingrules,users,receive,sharingoffers,status)values(#{redenvelopes},#{instructions},#{preferentialway},#{parvalue},#{threshold},#{totalissued},NOW(),date_sub(NOW(),interval -3 day),#{scopeofapplication},#{receivingrules},#{users},#{receive},#{sharingoffers},#{status})")
    int recharge(Red red);
}
